#include "demo.h"
#include "ui_demo.h"
#include"qtqrcode.h"
#include<QLabel>
#include<QFileDialog>

Demo::Demo(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Demo)
{
    ui->setupUi(this);
//    QLabel *l=new QLabel(this);
    QStringList sl;
    sl<<"设备名称：优盘"<<"设备编号：xxxx"<<"资产编号：xxx"<<"使用开始日期:2021-2-21 11111111111111111111111"<<"超期年限：12个月"<<"保养时间：月保养";
    QImage resultImage=QtQrcode().createQRCodeTag(sl);
    QPixmap pixmap=QPixmap::fromImage(resultImage);
    ui->label->setPixmap(pixmap);

//    QString fileName = QFileDialog::getSaveFileName(this, tr("Save file"), QString(),tr("Image file (*.png)"));
//    if(!fileName.isEmpty()){
//        resultImage.save(fileName);
//    }
}

Demo::~Demo()
{
    delete ui;
}
